package cn.sym.basic.util;

import lombok.Data;

@Data   //springmvc帮我们生成get和ser方法
public class AjaxResult {
    private Boolean success = true;
    private String message = "操作成功！！";
    private Object resultObj;


    public static AjaxResult my(){
        return new AjaxResult();
    }
    //链式编程,可以继续. 设置完成后自己对象返回
    public AjaxResult setSuccess(boolean success) {
        this.success = success;
        return this;
    }

    public AjaxResult setMessage(String message) {
        this.message = message;
        return this;
    }

    public AjaxResult setResultObj(Object resultObj) {
        this.resultObj = resultObj;
        return this;
    }

    //默认成功
    public AjaxResult() {
    }

    //失败调用
    public AjaxResult(String message) {
        this.success = false;
        this.message = message;
    }

}
